package com.server.tools.timertask;

import java.util.Calendar;

/**
 * 计时器任务的方法接口 也可以自己写
 * @author 李牧也
 * @since 2018/04/04
 * @version 1.0
 */
public class TimerTaskFunction {
	public static int day_of_week;
	public static int week_of_year;
	public static int year;
	public static int month;
	public static int day;
	public static int hour;
	public static int minute;
	public static int date;

	public void Test() {
		System.out.println("Hello World");
	}
	
	public void HourPlan() {
		Calendar cal = Calendar.getInstance();
		hour = cal.get(Calendar.HOUR_OF_DAY);
		System.out.println("现在是" + hour + "点整");
	}
	
	@SuppressWarnings("static-access")
	public void DayPlan() {
		Calendar cal = Calendar.getInstance();
		cal.setFirstDayOfWeek(cal.MONDAY);
		day_of_week = cal.get(Calendar.DAY_OF_WEEK)-1;
		if(day_of_week==0)day_of_week=7;
		year = cal.get(Calendar.YEAR);
		month = cal.get(Calendar.MONTH) + 1;
		day = cal.get(Calendar.DAY_OF_MONTH);
		date = year*10000;
		date += month*100;
		date += day;
		System.out.println(year + "/" + month + "/"+ day + " "+"星期" + day_of_week + " 这周是今年的第" + cal.get(Calendar.WEEK_OF_YEAR) + "周");
	}
}
